<meta http-equiv = "content-type" content = "text/html; charset = UTF-8">
<?php
	session_start();
	include("conn.php");
	if (isset($_POST["msg"]))
	{
		if($_POST["title"]=="" ) {
			echo "<script>alert('标题不能为空！');history.go(-1);</script>";
		}
		else if($_POST["content"]=="") {
			echo "<script>alert('内容不能为空！');history.go(-1);</script>";
		}
		else
		{
			$userinfo = $_SESSION['user'];
			$sql = "INSERT INTO content(id,username,title,content,time)
			VALUES (NULL,'$userinfo','$_POST[title]','$_POST[content]',now())";
			mysql_query($sql);
			echo "<script>alert('提交成功！点确定查看留言');location.href='message.php';</script>";
		}
	}
?>